import Rest from './request'
export function getStaffList(page: number, pagesize: number, keyword: string, departmentId: number) {
    return Rest.get(`/sys/user?page=${page}&pagesize=${pagesize}&keyword=${keyword}&departmentId=${departmentId}`)
}
export function getSelectList() {
    return Rest.get(`/company/department`)
}
export function getruleList(id: number) {
    return Rest.get(`/sys/user/${{ id }}`)
}
export function addStaff(data: any) {
    return Rest.post(`/sys/user`, JSON.stringify(data))
}
//员工删除
export function delStaff(id: string) {
    return Rest.delete(`/sys/user/${id}`)
}
//获取员工角色
export function getStaffRole(id: string) {
    return Rest.get(`/sys/user/${id}`)
}
export function getUserInfo() {
    return Rest.get('/sys/role/list/enabled')
}
//分配角色
export function setRole(data: any) {
    return Rest.put('/sys/user/assignRoles', data)
}
//修改员工基本信息
export function editStaff(id: string, data: any) {
    return Rest.put(`/sys/user/${id}`, JSON.stringify(data))
}
//群发通知
export function sendNotice(data: any) {
    return Rest.post('/sys/messageMuch', data)
}
//批量-导出员工excel
export function exportStaff() {
    return Rest.get('/sys/user/export', {
        responseType: "arraybuffer",
    })
}
// 批量-导入员工(上传excel)
export function importStaff(file: any) {
    return Rest.post('/sys/user/import', {file}, {
        headers: {
            'Content-Type': 'multipart/form-data',
        }
    })
}
// 批量-下载导入员工模板
export function downloadStaff() {
    return Rest.get('/sys/user/import/template', {
        responseType: "arraybuffer",
    })
}